package com.example.demo2.service.impl;

import com.example.demo2.entity.Course;
import com.example.demo2.mapper.CourseMapper;
import com.example.demo2.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseServiceImpl implements CourseService {

    @Autowired
    private CourseMapper courseMapper;


    @Override
    public int addCourse(Course course) {

                  return courseMapper.Lv_addCourse(course);
    }


    @Override
    public Course Lv_selectCourseById(Integer courseId) {
        return courseMapper.Lv_selectCourseById(courseId);
    }

    @Override
//    Integer userId
    public List<Course> Lv_showAllCourse() {
        return courseMapper.Lv_showAllCourse();
    }

    @Override
    public void Lv_deleteCourseById(Integer courseId) {
        courseMapper.Lv_deleteCourseById(courseId);

    }

    @Override
    public int Lv_updateCourseById(Course course) {
        return courseMapper.Lv_updateCourseById(course);

    }

    @Override
    public int Lv_updateHaveTarget(Integer courseId) {

        return courseMapper.Lv_updateHaveTarget(courseId);
    }

    public Course findNameById(Integer courseId){
        return courseMapper.findNameById(courseId);
    }
}
